package org.lds.message.center.admin.business.template.converter;

import org.lds.message.center.admin.business.template.entity.Template;
import org.lds.message.center.admin.business.template.model.request.TemplateBaseUpdateRequest;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;


@Component
public class TemplateBaseUpdateRequestToEntityConverter implements Converter<TemplateBaseUpdateRequest, Template> {

    @Override
    public Template convert(TemplateBaseUpdateRequest source) {
        return Template.builder()
                .id(source.getId())
                .appId(source.getAppId())
                .name(source.getName())
                .desc(source.getDesc())
                .enable(source.getEnable())
                .subject(source.getSubject())
                .text(source.getText())
                .modifier(source.getModifier())
                .updateTime(LocalDateTime.now())
                .build();
    }

}


